<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    861. Flipping an Image
   </h1>
   <p>
    Given a binary matrix
    <code>
     A
    </code>
    , we want to flip the image horizontally, then invert it, and return the resulting image.
   </p>
   <p>
    To flip an image horizontally means that each row of the image is reversed.&nbsp; For example, flipping&nbsp;
    <code>
     [1, 1, 0]
    </code>
    &nbsp;horizontally results in&nbsp;
    <code>
     [0, 1, 1]
    </code>
    .
   </p>
   <p>
    To invert an image means&nbsp;that each
    <code>
     0
    </code>
    is replaced by
    <code>
     1
    </code>
    , and each
    <code>
     1
    </code>
    is replaced by
    <code>
     0
    </code>
    .&nbsp;For example, inverting&nbsp;
    <code>
     [0, 1, 1]
    </code>
    &nbsp;results in&nbsp;
    <code>
     [1, 0, 0]
    </code>
    .
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input: </strong>[[1,1,0],[1,0,1],[0,0,0]]
<strong>Output: </strong>[[1,0,0],[0,1,0],[1,1,1]]
<strong>Explanation:</strong> First reverse each row: [[0,1,1],[1,0,1],[0,0,0]].
Then, invert the image: [[1,0,0],[0,1,0],[1,1,1]]
</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input: </strong>[[1,1,0,0],[1,0,0,1],[0,1,1,1],[1,0,1,0]]
<strong>Output: </strong>[[1,1,0,0],[0,1,1,0],[0,0,0,1],[1,0,1,0]]
<strong>Explanation:</strong> First reverse each row: [[0,0,1,1],[1,0,0,1],[1,1,1,0],[0,1,0,1]].
Then invert the image: [[1,1,0,0],[0,1,1,0],[0,0,0,1],[1,0,1,0]]
</pre>
   <p>
    <strong>
     Notes:
    </strong>
   </p>
   <ul>
    <li>
     <code>
      1 &lt;= A.length = A[0].length &lt;= 20
     </code>
    </li>
    <li>
     <code>
      0 &lt;= A[i][j]
      <font face="sans-serif, Arial, Verdana, Trebuchet MS">
       &nbsp;&lt;=&nbsp;
      </font>
      1
     </code>
    </li>
   </ul>
  </div>
  <div>
   <h1 class="question_title">
    861. 翻转图像
   </h1>
   <p>
    给定一个二进制矩阵&nbsp;
    <code>
     A
    </code>
    ，我们想先水平翻转图像，然后反转图像并返回结果。
   </p>
   <p>
    水平翻转图片就是将图片的每一行都进行翻转，即逆序。例如，水平翻转&nbsp;
    <code>
     [1, 1, 0]
    </code>
    &nbsp;的结果是&nbsp;
    <code>
     [0, 1, 1]
    </code>
    。
   </p>
   <p>
    反转图片的意思是图片中的&nbsp;
    <code>
     0
    </code>
    &nbsp;全部被&nbsp;
    <code>
     1
    </code>
    &nbsp;替换，&nbsp;
    <code>
     1
    </code>
    &nbsp;全部被&nbsp;
    <code>
     0
    </code>
    &nbsp;替换。例如，反转&nbsp;
    <code>
     [0, 1, 1]
    </code>
    &nbsp;的结果是&nbsp;
    <code>
     [1, 0, 0]
    </code>
    。
   </p>
   <p>
    <strong>
     示例 1:
    </strong>
   </p>
   <pre>
<strong>输入: </strong>[[1,1,0],[1,0,1],[0,0,0]]
<strong>输出: </strong>[[1,0,0],[0,1,0],[1,1,1]]
<strong>解释:</strong> 首先翻转每一行: [[0,1,1],[1,0,1],[0,0,0]]；
     然后反转图片: [[1,0,0],[0,1,0],[1,1,1]]
</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre>
<strong>输入: </strong>[[1,1,0,0],[1,0,0,1],[0,1,1,1],[1,0,1,0]]
<strong>输出: </strong>[[1,1,0,0],[0,1,1,0],[0,0,0,1],[1,0,1,0]]
<strong>解释:</strong> 首先翻转每一行: [[0,0,1,1],[1,0,0,1],[1,1,1,0],[0,1,0,1]]；
     然后反转图片: [[1,1,0,0],[0,1,1,0],[0,0,0,1],[1,0,1,0]]
</pre>
   <p>
    <strong>
     说明:
    </strong>
   </p>
   <ul>
    <li>
     <code>
      1 &lt;= A.length = A[0].length &lt;= 20
     </code>
    </li>
    <li>
     <code>
      0 &lt;= A[i][j]&nbsp;&lt;=&nbsp;1
     </code>
    </li>
   </ul>
  </div>
 </body>
</html>